package com.ruoyi.otc.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;//导包
import com.ruoyi.otc.mapper.OperationLogMapper;
import com.ruoyi.otc.domain.OperationLog;
import com.ruoyi.otc.service.IOperationLogService;
import com.ruoyi.common.core.text.Convert;

/**
 * 操作日志Service业务层处理
 *
 * @author gjp
 * @date 2024-05-22
 */
@Service
public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, OperationLog> implements IOperationLogService
{
    @Autowired
    private OperationLogMapper operationLogMapper;

    /**
     * 查询操作日志
     *
     * @param id 操作日志主键
     * @return 操作日志
     */
    @Override
    public OperationLog selectOperationLogById(Long id)
    {
        return operationLogMapper.selectById(id);
    }

    /**
     * 查询操作日志列表
     *
     * @param operationLog 操作日志
     * @return 操作日志
     */
    @Override
    public List<OperationLog> selectOperationLogList(OperationLog operationLog)
    {
        return operationLogMapper.selectList(new QueryWrapper<>(operationLog));
    }

    /**
     * 新增操作日志
     *
     * @param operationLog 操作日志
     * @return 结果
     */
    @Override
    public int insertOperationLog(OperationLog operationLog)
    {
            return operationLogMapper.insert(operationLog);
    }

    /**
     * 修改操作日志
     *
     * @param operationLog 操作日志
     * @return 结果
     */
    @Override
    public int updateOperationLog(OperationLog operationLog)
    {
        return operationLogMapper.updateById(operationLog);
    }

    /**
     * 批量删除操作日志
     *
     * @param ids 需要删除的操作日志主键
     * @return 结果
     */
    @Override
    public int deleteOperationLogByIds(String ids)
    {
        return operationLogMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除操作日志信息
     *
     * @param id 操作日志主键
     * @return 结果
     */
    @Override
    public int deleteOperationLogById(Long id)
    {
        return operationLogMapper.deleteById(id);
    }
}
